#ifndef GAME_H
#define GAME_H

#include <QMap>
#include <QSharedPointer>
#include "GameBoard.h"
#include "GameSettings.h"
#include "Player.h"
#include "Tank.h"

class Game
{
public:
    Game();

    inline QList< Player > Players() const { return m_players; }

    void SetPlayers(const QList<Player> players);

    void SetSettings(GameSettings settings) { m_gameSettings = settings; }
    GameSettings Settings() const { return m_gameSettings; }

    void AddPlayer(const Player &new_player);
    void RemovePlayer(int id);

    TankPtr PlayersTank(int player_id)
    {
        QList<TankPtr> tanks = *m_gameboard->Tanks();
        TankPtr tank;
        foreach(tank, tanks)
        {
            if(tank->Id() == player_id)
                return tank;
        }
        return tank;
    }

    GameBoardPtr GameBoard() const { return m_gameboard; }

private:

    QList< Player > m_players;
    GameBoardPtr m_gameboard;
    GameSettings m_gameSettings;
};

typedef QSharedPointer<Game> GamePtr;

#endif // GAME_H
